home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-10 | 3.1 KB | 126 lines | [TEXT/KAHL] |
- /******************************************************************************
- CARDirector.c
-
-
- SUPERCLASS = CDLOGDirector
-
- Copyright © 1991 Symantec Corporation. All rights reserved.
-
-
- ******************************************************************************/
-
- #include "CARDirector.h"
- #include <CScrollPane.h>
- #include <CDialogText.h>
- #include <CDialog.h>
- #include <CPaneBorder.h>
- #include <CApplication.h>
- #include <CTextEnvirons.h>
- #include <CIntegerText.h>
- #include "CARArray.h"
- #include "CARTable.h"
-
- static Boolean ByKind( CView *scrollPane, void* targetID)
- {
- return member(scrollPane, CScrollPane);
- }
-
- static Boolean ByKind_set_text( CView *pane, void* targetID)
- {
- if (member(pane, CIntegerText))
- {
- long **value = (long **)targetID;
- ((CIntegerText *)pane)->SetIntValue(**value);
- ((CIntegerText *)pane)->Specify( kNotEditable, kNotSelectable, kNotStylable);
- (*value)++;
- }
- return false;
- }
-
- void CARDirector::IARDirector( short ARid, CDirectorOwner *aSupervisor)
- {
- Handle Data = GetResource( 'AR', ARid);
- Str255 rName;
- ResType rType;
- FailNILRes(Data);
- GetResInfo(Data,&ARid,&rType,rName);
- rName[1] = rName[0]-1; /* get rid of initial null */
- NewDocument(Data, aSupervisor, rName+1);
- }
-
- void CARDirector::NewDocument( Handle Data, CDirectorOwner *aSupervisor, Str255 name)
- {
- CScrollPane *scrollPane;
-
- CDLOGDirector::IDLOGDirector( 10000, aSupervisor);
-
- itsData = Data;
- itsWindow->SetTitle(name);
- scrollPane = (CScrollPane *)itsWindow->MatchView( ByKind, 0);
-
- if (scrollPane)
- {
- CPaneBorder *listBorder;
- Rect margin;
- Cell aCell;
- TextInfoRec textInfo;
- textInfo.fontNumber = monaco;
- textInfo.theSize = 9;
- textInfo.theStyle = 0;
- textInfo.theMode = srcOr;
-
- itsStringTable = new( CARTable);
- itsStringTable->IArrayPane( scrollPane, itsWindow, 0, 0, 0, 0,
- sizELASTIC, sizELASTIC);
- itsStringTable->FitToEnclosure( TRUE, TRUE);
- itsStringTable->SetDrawActiveBorder( TRUE);
- ((CTextEnvirons *)(itsStringTable->itsEnvironment))->SetTextInfo( &textInfo);
- itsStringTable->SetID( 10);
-
- listBorder = new( CPaneBorder);
- listBorder->IPaneBorder( kBorderFrame);
-
- itsStringTable->SetBorder( listBorder);
-
- itsStringTable->SetSelectionFlags( selOnlyOne);
-
- scrollPane->InstallPanorama( itsStringTable);
-
- itsStrings = new( CARArray);
- itsStrings->IResHandle( itsData );
- itsStrings->Sort(TRUE);
-
- itsStringTable->SetArray( itsStrings, FALSE);
-
- SetCell( aCell, 0, 0);
- itsStringTable->SelectCell( aCell, FALSE, FALSE);
-
- }
-
- if (itsStrings)
- {
- long temp[10];
- long *ptr = temp;
- *ptr++ = itsStrings->execp->a_text;
- *ptr++ = itsStrings->execp->a_data;
- *ptr++ = itsStrings->execp->a_bss;
- *ptr++ = itsStrings->execp->a_syms/sizeof (struct nlist);
- *ptr++ = itsStrings->execp->a_entry;
- *ptr++ = itsStrings->execp->a_trsize;
- *ptr++ = itsStrings->execp->a_drsize;
- *ptr++ = temp[0]+temp[1]+temp[2]+
- temp[3]*sizeof (struct nlist)+
- temp[5]+temp[6];
- ptr = temp;
- itsWindow->MatchView( ByKind_set_text, &ptr);
- }
- } /* CARDirector::IARDirector */
-
-
- void CARDirector::Dispose( void)
- {
- itsStrings = 0;
- inherited::Dispose();
- }
-
-